home *** CD-ROM | disk | FTP | other *** search
Text File | 2008-11-13 | 82.4 KB | 3,068 lines |
- function InitRound()
- {
- lowtime_s = new Sound();
- lowtime_s.attachSound("lowtime");
- notBlock = false;
- stats_s.stop();
- Mouse.removeListener(oMouse);
- _root.attachMovie("panelleft","panelleft",_root.getNextHighestDepth());
- _root.attachMovie(countries[RoundCountry].substr(0,1).toLowerCase() + "shad","shadow",_root.getNextHighestDepth());
- _root.attachMovie(countries[RoundCountry],"gamepanel",_root.getNextHighestDepth());
- _root.attachMovie("timeline","TIME",_root.getNextHighestDepth());
- _root.attachMovie("Score","SCORE",_root.getNextHighestDepth());
- _root.attachMovie("menubutton","button",_root.getNextHighestDepth());
- _root.attachMovie("smalltext","country1",_root.getNextHighestDepth());
- _root.attachMovie("smalltext","sity1",_root.getNextHighestDepth());
- TextShow(country1,countries[RoundCountry],"l",0,0,1);
- TextShow(sity1,sities[RoundCountry][RoundSity],"l",0,0,1);
- country1._x = 95;
- country1._y = 3;
- sity1._x = 95;
- sity1._y = 217;
- TIME._x = 224;
- TIME._y = 327;
- gamepanel._x = 194;
- SCORE._y = 242;
- SCORE._x = 100;
- shadow._x = ArtX;
- shadow._y = ArtY;
- button._x = 40;
- button._y = 315;
- button.onPress = bRel;
- button.onRelease = MenuPress;
- button.onReleaseOutside = MenuPress;
- TextShow(SCORE,String(score),"sc",0,0,1);
- Nomer = 4 + RoundCountry;
- delete Matrix;
- Matrix = new Array();
- generateMatrix(RoundCountry,RoundSity,Matrix);
- GlobalX = 270 - (Size - 29) * 7 - (Matrix[0].length - 7) * (Size / 2);
- GlobalY = 75 - (Size - 29) * 7 - (Matrix.length - 7) * (Size / 2);
- _root.attachMovie("smalltext","hamn",_root.getNextHighestDepth(),{_x:HamX + 25,_y:HamY + 20});
- _root.attachMovie("smalltext","dign",_root.getNextHighestDepth(),{_x:DigX + 25,_y:DigY + 20});
- _root.attachMovie("smalltext","watn",_root.getNextHighestDepth(),{_x:WatX + 25,_y:WatY + 20});
- _root.attachMovie("smalltext","lamn",_root.getNextHighestDepth(),{_x:LamX + 25,_y:LamY + 20});
- if(Hammer)
- {
- _root.attachMovie("hammer","hammer",_root.getNextHighestDepth());
- hammer._x = HamX;
- hammer._y = HamY;
- hammer.onPress = onHammerClick;
- TextShow(hamn,"x" + Hammer,"h",0,0,0);
- }
- if(Watch)
- {
- _root.attachMovie("watch","watch",_root.getNextHighestDepth());
- watch._x = WatX;
- watch._y = WatY;
- watch.onPress = onWatchClick;
- TextShow(watn,"x" + Watch,"h",0,0,0);
- }
- if(Digger)
- {
- _root.attachMovie("digger","digger",_root.getNextHighestDepth());
- digger._x = DigX;
- digger._y = DigY;
- digger.onPress = onDiggerClick;
- TextShow(dign,"x" + Digger,"h",0,0,0);
- }
- if(Lamp)
- {
- _root.attachMovie("lamp","lamp",_root.getNextHighestDepth());
- lamp._x = LamX;
- lamp._y = LamY;
- lamp.onPress = onLampClick;
- TextShow(lamn,"x" + Lamp,"h",0,0,0);
- }
- ResetTimer();
- StopTimer();
- Add = Matches = Chain = MaxChain = Tiles = EndX = 0;
- Blink = "no";
- Mouse.show();
- DrawLife();
- DrawArt();
- PreDraw();
- }
- function CallFall()
- {
- clearInterval(ifall);
- ifall = setInterval(function()
- {
- clearInterval(ifall);
- FallDown(Matrix);
- }
- ,100);
- }
- function bRel()
- {
- if(notBlock && redytoend && !moveart)
- {
- inMenu = true;
- this._y += 3;
- }
- }
- function ClearRound(Matrix)
- {
- StopHint();
- hamn.removeMovieClip();
- lamn.removeMovieClip();
- dign.removeMovieClip();
- watn.removeMovieClip();
- country1.removeMovieClip();
- sity1.removeMovieClip();
- clearInterval(DD);
- clearINterval(HHH);
- SCORE.removeMovieClip();
- TIME.removeMovieClip();
- gamepanel.removeMovieClip();
- shadow.removeMovieClip();
- panelleft.removeMovieClip();
- hammer.removeMovieClip();
- digger.removeMovieClip();
- watch.removeMovieClip();
- lamp.removeMovieClip();
- ham.removeMovieClip();
- button.removeMovieClip();
- bl.removeMovieClip();
- mainmenu.removeMovieClip();
- var i = 0;
- while(i < Matrix.length)
- {
- var j = 0;
- while(j < Matrix[i].length)
- {
- var temp = FindName(i,j);
- eval(temp).removeMovieClip();
- eval("s" + j).removeMovieClip();
- eval(temp + "fon").removeMovieClip();
- clearInterval(_root["m" + temp]);
- clearInterval(_root["b" + temp]);
- clearInterval(_root[MATP + Name]);
- clearInterval(_root["m" + i + j]);
- clearInterval(_root["m" + String(eval("s" + i + j))]);
- j++;
- }
- i++;
- }
- i = 1;
- while(i < 50)
- {
- var Name = countries[RoundCountry].substr(0,1).toLowerCase() + "slice" + i;
- eval(Name).removeMovieClip();
- eval("heart" + Number(i - 1)).removeMovieClip();
- eval("border" + Number(i - 1)).removeMovieClip();
- eval("corner" + Number(i - 1)).removeMovieClip();
- i++;
- }
- }
- function InitSound()
- {
- Art_s = new Sound();
- Art_s.attachSound("Art.mp3");
- art_s = new Sound();
- art_s.attachSound("artefact");
- bonus_s = new Sound();
- bonus_s.attachSound("bonus");
- digger_s = new Sound();
- digger_s.attachSound("diggers");
- endexplode_s = new Sound();
- endexplode_s.attachSound("endexplode");
- hint_s = new Sound();
- hint_s.attachSound("hint_s");
- lamp_s = new Sound();
- lamp_s.attachSound("lamps");
- lowtime_s = new Sound();
- lowtime_s.attachSound("lowtime");
- match1_s = new Sound();
- match1_s.attachSound("match1");
- match2_s = new Sound();
- match2_s.attachSound("match2");
- stats_s = new Sound();
- stats_s.attachSound("stats");
- time_s = new Sound();
- time_s.attachSound("time");
- no_s = new Sound();
- no_s.attachSound("no");
- yes_s = new Sound();
- yes_s.attachSound("yes");
- click_s = new Sound();
- click_s.attachSound("click");
- hammer_s = new Sound();
- hammer_s.attachSound("hammers");
- scores_s = new Sound();
- scores_s.attachSound("Scores");
- start_s = new Sound();
- start_s.attachSound("start");
- watch_s = new Sound();
- watch_s.attachSound("watchs");
- }
- function PreDraw()
- {
- _root.attachMovie("black","bl",_root.getNextHighestDepth());
- bl._width = 520;
- bl._height = 390;
- bl._alpha = 50;
- bl.useHandCursor = false;
- start_s = new Sound();
- start_s.attachSound("start");
- bl.onPress = function()
- {
- clearInterval(showing);
- clearInterval(showing1);
- clearInterval(showing2);
- bigtext.removeMovieClip();
- var Done = true;
- var i = 0;
- while(i < Matrix.length)
- {
- if(eval("s" + i + "0") != undefined)
- {
- Done = false;
- }
- i++;
- }
- delete start_s;
- if(Done)
- {
- DrawFon(GlobalX,GlobalY,Matrix);
- }
- var i = 0;
- while(i < Matrix.length)
- {
- clearInterval(_root["Fallb" + i]);
- var j = 0;
- while(j < Matrix[0].length)
- {
- eval("s" + i + j)._x = GlobalX + Size * j;
- eval("s" + i + j)._y = GlobalY + i * Size;
- if(Matrix[i][j].substr(1,3) != "sli")
- {
- eval("s" + i + j)._x += Size / 2 - eval("s" + i + j)._width / 2;
- eval("s" + i + j)._y += Size / 2 - eval("s" + i + j)._height / 2;
- }
- eval("s" + i + j)._alpha = 100;
- j++;
- }
- i++;
- }
- ShowBlink();
- TIME.time1._x = 0;
- bl.removeMovieClip();
- };
- var str = countries[RoundCountry] + ", " + sities[RoundCountry][RoundSity] + "|Level " + Number(RoundCountry + 1) + "-" + Number(RoundSity + 1);
- _root.attachMovie("bigtext","bigtext",_root.getNextHighestDepth(),{_x:360,_y:180,_alpha:0});
- if(countries[RoundCountry].length + sities[RoundCountry][RoundSity].length > 13)
- {
- var u = countries[RoundCountry].length + sities[RoundCountry][RoundSity].length - 13;
- bigtext._x -= u * 12;
- }
- TextShow(bigtext,str,"t",5,30,1);
- showing = setInterval(ShowBeginText,10,1);
- showing1 = setInterval(function()
- {
- clearInterval(showing1);
- clearInterval(showing);
- bigtext._alpha = 0;
- if(Life == 0)
- {
- str = nolife;
- }
- else if(Life == 1)
- {
- str = onelife;
- }
- else
- {
- str = Life + manylives;
- }
- TextShow(bigtext,str,"t",0,30,1);
- bigtext._x = 360;
- showing = setInterval(ShowBeginText,10,1);
- }
- ,2500);
- showing2 = setInterval(function()
- {
- clearInterval(showing);
- clearInterval(showing2);
- bigtext.removeMovieClip();
- DrawFon(GlobalX,GlobalY,Matrix);
- }
- ,5000);
- }
- function ShowBeginText(l)
- {
- if(l == 1)
- {
- if(bigtext._alpha >= 100)
- {
- clearInterval(showing);
- showing = setInterval(ShowBeginText,10,-1);
- }
- else
- {
- bigtext._alpha += 2;
- }
- }
- else if(bigtext._alpha <= 3)
- {
- clearInterval(showing);
- }
- else
- {
- bigtext._alpha -= 2;
- }
- }
- function TextShow(Inside, Str, l, W, H, C)
- {
- function Attach(STR)
- {
- Inside.TEXT.attachMovie(STR + l,U,Inside.TEXT.getNextHighestDepth(),{_x:X,_y:Y});
- wid = eval(String(Inside) + ".TEXT." + U)._width;
- X += wid + W;
- }
- var X = 0;
- var Y = 0;
- var L = 0;
- var wid = 0;
- Inside.TEXT.removeMovieClip();
- Inside.createEmptyMovieClip("TEXT",Inside.getNextHighestDepth());
- var i = 0;
- while(i < Str.length)
- {
- var j = Str.substr(i,1).toLowerCase();
- if(j == "|")
- {
- if(C == 1)
- {
- X /= 2;
- var k = 0;
- while(k < Str.length)
- {
- eval(String(Inside) + ".TEXT.t" + k + L)._x -= X;
- k++;
- }
- }
- else if(C == 2)
- {
- var k = 0;
- while(k < Str.length)
- {
- eval(String(Inside) + ".TEXT.t" + k + L)._x -= X;
- k++;
- }
- }
- L++;
- X = 0;
- Y += H;
- }
- else
- {
- var U = "t" + i + L;
- if(j == " ")
- {
- X += eval(String(Inside) + ".TEXT.t00")._width * 3 / 4;
- }
- else if(j == ",")
- {
- Attach("zpt");
- }
- else if(j == ".")
- {
- Attach("dot");
- }
- else if(j == ":")
- {
- Attach("dd");
- }
- else if(j == "-")
- {
- Attach("tire");
- }
- else
- {
- Attach(String(j));
- }
- }
- i++;
- }
- if(C == 1)
- {
- X /= 2;
- var k = 0;
- while(k < Str.length)
- {
- eval(String(Inside) + ".TEXT.t" + k + L)._x -= X;
- k++;
- }
- }
- else if(C == 2)
- {
- var k = 0;
- while(k < Str.length)
- {
- eval(String(Inside) + ".TEXT.t" + k + L)._x -= X;
- k++;
- }
- }
- return L;
- }
- function ScoreAdd(chk)
- {
- var _loc1_ = 5;
- if(chk == "y")
- {
- _loc1_ = 20;
- }
- if(Add > 0)
- {
- score += _loc1_;
- Add -= _loc1_;
- redytoend = false;
- TextShow(SCORE,String(score),"sc",0,0,1);
- if(score >= NextLife)
- {
- Life++;
- if(SoundOn)
- {
- life_s.start();
- }
- NextLife += 35000;
- }
- }
- else
- {
- clearInterval(scoring);
- redytoend = true;
- }
- }
- function Score(ADD, chk)
- {
- Add += ADD;
- var _loc1_ = 0;
- if(Add < 30)
- {
- _loc1_ = 200;
- }
- else if(Add < 100)
- {
- _loc1_ = 20;
- }
- clearInterval(scoring);
- scoring = setInterval(ScoreAdd,_loc1_,chk);
- }
- function MenuDownload(i, j, str, b)
- {
- if(b)
- {
- mainmenu["b" + i].onPress = _root[str];
- TextShow(mainmenu["txt" + i],_root["menubutton" + j],"b",-2,15,1);
- mainmenu["b" + i].onRollOver = function()
- {
- TextShow(mainmenu["txt" + i],_root["menubutton" + j],"l",-1,15,1);
- };
- mainmenu["b" + i].onRollOut = function()
- {
- TextShow(mainmenu["txt" + i],_root["menubutton" + j],"b",-2,15,1);
- };
- }
- else
- {
- mainmenu["b" + i]._visible = false;
- }
- }
- function MenuPress()
- {
- if(inMenu)
- {
- var n = 4;
- var a = String(GetVar("alawar_f"));
- if(a == "0" || a == "false")
- {
- n++;
- }
- var c = String(GetVar("close_f"));
- if(c != "0")
- {
- n++;
- }
- var M = "menu" + n;
- inMenu = false;
- button._y -= 3;
- StopHint();
- StopTimer();
- notBlock = false;
- _root.attachMovie("black","bl",_root.getNextHighestDepth());
- bl._alpha = 50;
- bl._width = 520;
- bl._height = 390;
- _root.attachMovie("mainmenu","mainmenu",_root.getNextHighestDepth(),{_x:200,_y:50});
- mainmenu.mmm.attachMovie(M,"menu",0);
- mainmenu.b1.onPress = FunctionHelp;
- mainmenu.b2.onPress = FunctionSound;
- if(a != "true" && c != "0")
- {
- MenuDownload(3,2,"FunctionDownload",true);
- MenuDownload(4,3,"FunctionNew",true);
- MenuDownload(6,4,"FunctionResume",true);
- MenuDownload(5,6,"FunctionExit",true);
- }
- else if(a != "true" && c == "0")
- {
- MenuDownload(3,2,"FunctionDownload",true);
- MenuDownload(4,3,"FunctionNew",true);
- MenuDownload(5,4,"FunctionResume",true);
- MenuDownload(6,4,"F");
- }
- else if(a == "true" && c != "0")
- {
- MenuDownload(3,3,"FunctionNew",true);
- MenuDownload(5,4,"FunctionResume",true);
- MenuDownload(4,6,"FunctionExit",true);
- MenuDownload(6,6,"F");
- }
- else
- {
- MenuDownload(3,3,"FunctionNew",true);
- MenuDownload(4,4,"FunctionResume",true);
- MenuDownload(5,6,"F");
- MenuDownload(6,6,"F");
- }
- mainmenu.b1.onRollOver = function()
- {
- TextShow(mainmenu.txt1,_root.menubutton0,"l",-1,15,1);
- };
- mainmenu.b1.onRollOut = function()
- {
- TextShow(mainmenu.txt1,_root.menubutton0,"b",-2,15,1);
- };
- TextShow(mainmenu.txt1,_root.menubutton0,"b",-2,15,1);
- if(SoundOn)
- {
- TextShow(mainmenu.txt2,_root.menubutton1,"b",-2,15,1);
- mainmenu.b2.onRollOver = function()
- {
- TextShow(mainmenu.txt2,_root.menubutton1,"l",-1,15,1);
- };
- mainmenu.b2.onRollOut = function()
- {
- TextShow(mainmenu.txt2,_root.menubutton1,"b",-2,15,1);
- };
- }
- else
- {
- TextShow(mainmenu.txt2,_root.menubutton5,"b",-2,15,1);
- mainmenu.b2.onRollOver = function()
- {
- TextShow(mainmenu.txt2,_root.menubutton5,"l",-1,15,1);
- };
- mainmenu.b2.onRollOut = function()
- {
- TextShow(mainmenu.txt2,_root.menubutton5,"b",-2,15,1);
- };
- }
- }
- }
- function FunctionHelp()
- {
- this._y += 3;
- this._parent.txt1._y += 3;
- clearInterval(LLL);
- LLL = setInterval(function()
- {
- clearInterval(LLL);
- _root.attachMovie("helppanel","help",_root.getNextHighestDepth());
- }
- ,300);
- }
- function FunctionSound()
- {
- this._y += 3;
- this._parent.txt2._y += 3;
- SoundOn = !SoundOn;
- if(SoundOn)
- {
- TextShow(mainmenu.txt2,_root.menubutton1,"l",-1,15,1);
- mainmenu.b2.onRollOver = function()
- {
- TextShow(mainmenu.txt2,_root.menubutton1,"l",-1,15,1);
- };
- mainmenu.b2.onRollOut = function()
- {
- TextShow(mainmenu.txt2,_root.menubutton1,"b",-2,15,1);
- };
- }
- else
- {
- TextShow(mainmenu.txt2,_root.menubutton5,"l",-1,15,1);
- mainmenu.b2.onRollOver = function()
- {
- TextShow(mainmenu.txt2,_root.menubutton5,"l",-1,15,1);
- };
- mainmenu.b2.onRollOut = function()
- {
- TextShow(mainmenu.txt2,_root.menubutton5,"b",-2,15,1);
- };
- }
- }
- function FunctionDownload()
- {
- this._y += 3;
- this._parent.txt3._y += 3;
- LLL = setInterval(function()
- {
- clearInterval(LLL);
- if(GetVar("link") == "0")
- {
- getURL(downloadlink,"_blank");
- }
- else
- {
- getURL(GetVar("link"),"");
- }
- if(GetVar("dload_f") != "0")
- {
- getURL("JavaScript:" + GetVar("dload_f") + "()","");
- }
- }
- ,300);
- }
- function FunctionNew()
- {
- this._y += 3;
- this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y = this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y + 3;
- RoundCountry = RoundSity = Hammer = Lamp = Digger = Watch = Chain = Matches = MaxChain = Tiles = EndX = score = 0;
- delete ArtPos;
- ArtPos = new Array();
- InitArt(RoundCountry,RoundSity);
- clearInterval(LLL);
- LLL = setInterval(function()
- {
- clearInterval(LLL);
- ClearRound(Matrix);
- InitRound();
- }
- ,300);
- }
- function FunctionResume()
- {
- this._y += 3;
- this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y = this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y + 3;
- clearInterval(LLL);
- LLL = setInterval(function()
- {
- clearInterval(LLL);
- notBlock = true;
- StartTimer();
- bl.removeMovieClip();
- mainmenu.removeMovieClip();
- nag.removeMovieClip();
- RedyToPlay = true;
- StartHint();
- }
- ,300);
- }
- function FunctionExit()
- {
- this._y += 3;
- this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y = this._parent["txt" + this._name.substr(this._name.length - 1,1)]._y + 3;
- clearInterval(LLL);
- LLL = setInterval(function()
- {
- clearInterval(LLL);
- var _loc1_ = GetVar("close_f");
- getURL("JavaScript:" + _loc1_ + "()","");
- }
- ,500);
- }
- function DrawArt()
- {
- var i = 1;
- while(i <= ArtPos.length)
- {
- if(ArtPos[i].is == true)
- {
- var Name = countries[RoundCountry].substr(0,1).toLowerCase() + "slice" + i;
- var X = ArtPos[Number(Name.substr(6,2))].x;
- var Y = ArtPos[Number(Name.substr(6,2))].y;
- _root.attachMovie(Name,Name,_root.getNextHighestDepth());
- }
- eval(Name)._x = X;
- eval(Name)._y = Y;
- i++;
- }
- }
- function FGameOver()
- {
- Life = 3;
- RoundCountry = RoundSity = Hammer = Lamp = Digger = Watch = Chain = Matches = MaxChain = Tiles = EndX = score = 0;
- delete ArtPos;
- ArtPos = new Array();
- InitArt(RoundCountry,RoundSity);
- ClearRound(Matrix);
- InitRound();
- }
- function GameOver()
- {
- Life--;
- StopTimer();
- bl.removeMovieClip();
- _root.attachMovie("black","bl",_root.getNextHighestDepth(),{_width:520,_height:390,_alpha:0});
- bl.onPress = AAA;
- bl.useHandCursor = false;
- if(Life == -1)
- {
- clearInterval(ER);
- RoundCountry = MaxC + 1;
- RoundSity = 99;
- ER = setInterval(EndRound,20,Matrix);
- }
- else
- {
- clearing = setInterval(function()
- {
- if(!Fall)
- {
- clearInterval(clearing);
- ClearRound(Matrix);
- InitRound();
- }
- }
- ,20);
- }
- }
- function Timing()
- {
- var temp = 100 * (EndTime - getTimer()) / totaltime;
- TIME.time1._x = (temp - 100) * 270 / 100;
- if(temp < 1)
- {
- GameOver();
- }
- else if(temp < 20)
- {
- if(SoundOn && lowtime_s.position == 0)
- {
- lowtime_s.start();
- }
- if(warningtime)
- {
- warningtime = false;
- _root.attachMovie("timewarn","warn",_root.getNextHighestDepth());
- warn._xscale = temp;
- warn._x = 224;
- warn._y = 327;
- }
- else
- {
- warn.removeMovieClip();
- warningtime = true;
- }
- if(htime)
- {
- htime = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,"time");
- }
- }
- updateAfterEvent();
- }
- function DrawLife()
- {
- var i = 0;
- while(i < 3)
- {
- eval("heart" + i).removeMovieClip;
- i++;
- }
- var i = 0;
- while(i < Life && i < 3)
- {
- var X = 76;
- var Y = 277;
- _root.attachMovie("heart","heart" + i,_root.getNextHighestDepth());
- eval("heart" + i)._x = X + i * 15;
- eval("heart" + i)._y = Y;
- i++;
- }
- }
- function ResetTimer()
- {
- clearInterval(TI);
- totaltime = Number(sitytime[RoundCountry][RoundSity]) * 1000;
- EndTime = Number(getTimer()) + totaltime;
- stopped = 0;
- StartTimer();
- }
- function StartTimer()
- {
- if(stopped)
- {
- EndTime += getTimer() - stopped;
- BeginTime += getTimer() - stopped;
- stopped = 0;
- }
- clearInterval(TI);
- TI = setInterval(Timing,100);
- }
- function StopTimer()
- {
- StopHint();
- stopped = getTimer();
- clearInterval(TI);
- }
- function gen(Matrix)
- {
- Line = new Array("slide2","slide2","slide3","slide4");
- Matrix[0] = Line;
- Line = new Array("slide1","hammer","digger","slide2");
- Matrix[1] = Line;
- Line = new Array("slide3","slide2","slide2","slide1");
- Matrix[2] = Line;
- }
- function InitArt(Country, Sity)
- {
- function PUSH(x, y)
- {
- Line = new Array("x","y","is");
- Line.x = x + ArtX;
- Line.y = y + ArtY;
- ArtPos.push(Line);
- }
- var Line = new Array();
- if(Country == 0)
- {
- PUSH(0,0);
- PUSH(56,26);
- PUSH(78,26);
- PUSH(42,39);
- PUSH(54,37);
- PUSH(77,37);
- PUSH(104,37);
- PUSH(34,63);
- PUSH(53,63);
- PUSH(77,63);
- PUSH(101,63);
- PUSH(35,87);
- PUSH(52,86);
- PUSH(77,87);
- PUSH(103,87);
- PUSH(54,112);
- PUSH(77,112);
- }
- else if(Country == 1)
- {
- PUSH(0,0);
- PUSH(93,130);
- PUSH(54,93);
- PUSH(56,56);
- PUSH(13,57);
- PUSH(30,53);
- PUSH(31,81);
- PUSH(81,4);
- PUSH(39,61);
- PUSH(95,81);
- PUSH(74,127);
- PUSH(63,134);
- PUSH(77,134);
- PUSH(42,16);
- PUSH(67,41);
- PUSH(61,3);
- PUSH(97,55);
- PUSH(57,30);
- PUSH(126,51);
- PUSH(79,31);
- PUSH(109,51);
- PUSH(75,76);
- PUSH(17,82);
- PUSH(31,29);
- PUSH(124,97);
- PUSH(27,108);
- PUSH(12,35);
- PUSH(83,54);
- PUSH(129,82);
- PUSH(94,104);
- PUSH(42,104);
- PUSH(62,116);
- PUSH(53,81);
- PUSH(111,78);
- PUSH(109,105);
- PUSH(43,125);
- PUSH(75,101);
- PUSH(83,118);
- }
- else
- {
- PUSH(0,0);
- PUSH(62,46);
- PUSH(30,98);
- PUSH(57,135);
- PUSH(104,139);
- PUSH(53,90);
- PUSH(79,87);
- PUSH(111,46);
- PUSH(20,7);
- PUSH(85,53);
- PUSH(78,64);
- PUSH(83,112);
- PUSH(36,113);
- PUSH(62,66);
- PUSH(49,118);
- PUSH(23,60);
- PUSH(46,72);
- PUSH(24,81);
- PUSH(59,108);
- PUSH(108,114);
- PUSH(103,69);
- PUSH(85,128);
- PUSH(33,1);
- PUSH(127,136);
- PUSH(79,137);
- PUSH(37,139);
- PUSH(38,42);
- PUSH(94,60);
- PUSH(103,92);
- PUSH(31,24);
- PUSH(13,34);
- }
- }
- function Blow(i, j)
- {
- var temp = Matrix[i][j];
- var slide = eval(FindName(i,j));
- if(temp.substr(0,5) == "lock1")
- {
- Matrix[i][j] = temp.substr(5,10);
- slide.l.removeMovieClip();
- InitSlide(slide);
- }
- else if(temp.substr(0,5) == "lock2")
- {
- Matrix[i][j] = "lock1" + temp.substr(5,10);
- slide.l.removeMovieClip();
- slide.attachMovie("lock1","l",_root.getNextHighestDepth(),{_width:Size,_height:Size});
- }
- else
- {
- Tiles++;
- Score(5 * (Chain + 1));
- var Depth = slide.getDepth();
- slide.removeMovieClip();
- var Name = FindName(i,j);
- eval(Name + "b").removeMovieClip();
- _root.attachMovie("blow",Name + "b",Depth);
- eval(Name + "b").txt.txt.text = 5 * (Chain + 1);
- eval(Name + "b")._x = GlobalX + j * Size;
- eval(Name + "b")._y = GlobalY + i * Size;
- Matrix[i][j] += "b";
- _root["b" + Name] = setInterval(function()
- {
- Matrix[i][j] = "no";
- clearInterval(_root["b" + FindName(i,j)]);
- }
- ,0);
- }
- }
- function FindChain(Matrix)
- {
- var _loc5_ = false;
- var _loc2_ = 0;
- while(_loc2_ < Matrix.length)
- {
- var _loc1_ = 0;
- while(_loc1_ < Matrix[_loc2_].length)
- {
- var _loc4_ = Matrix[_loc2_][_loc1_];
- if(_loc4_.substr(0,4) == "lock")
- {
- _loc4_ = _loc4_.substr(5,10);
- }
- else
- {
- _loc4_ = Matrix[_loc2_][_loc1_].substr(0,6);
- }
- if(_loc4_.substr(0,1) == "s")
- {
- if((Matrix[_loc2_ - 1][_loc1_].substr(0,6) == _loc4_ || Matrix[_loc2_ - 1][_loc1_].substr(5,10) == _loc4_) && (Matrix[_loc2_ + 1][_loc1_].substr(0,6) == _loc4_ || Matrix[_loc2_ + 1][_loc1_].substr(5,10) == _loc4_))
- {
- if(Matrix[_loc2_ - 1][_loc1_].substr(6,1) != "b")
- {
- Blow(_loc2_ - 1,_loc1_);
- }
- if(Matrix[_loc2_][_loc1_].substr(6,1) != "b")
- {
- Blow(_loc2_,_loc1_);
- }
- if(Matrix[_loc2_ + 1][_loc1_].substr(6,1) != "b")
- {
- Blow(_loc2_ + 1,_loc1_);
- }
- _loc5_ = true;
- }
- if((Matrix[_loc2_][_loc1_ - 1].substr(0,6) == _loc4_ || Matrix[_loc2_][_loc1_ - 1].substr(5,10) == _loc4_) && (Matrix[_loc2_][_loc1_ + 1].substr(0,6) == _loc4_ || Matrix[_loc2_][_loc1_ + 1].substr(5,10) == _loc4_))
- {
- if(Matrix[_loc2_][_loc1_ - 1].substr(6,1) != "b")
- {
- Blow(_loc2_,_loc1_ - 1);
- }
- if(Matrix[_loc2_][_loc1_].substr(6,1) != "b")
- {
- Blow(_loc2_,_loc1_);
- }
- if(Matrix[_loc2_][_loc1_ + 1].substr(6,1) != "b")
- {
- Blow(_loc2_,_loc1_ + 1);
- }
- _loc5_ = true;
- }
- }
- _loc1_ = _loc1_ + 1;
- }
- _loc2_ = _loc2_ + 1;
- }
- return _loc5_;
- }
- function FallBegin(x, j, Matrix)
- {
- var l = 5;
- var k = 0;
- mmm += 270 * l / (Matrix[0].length * 100);
- while(eval(FindName(k,j)) == undefined)
- {
- k++;
- }
- if(eval(FindName(k,j))._y >= GlobalY + k * Size)
- {
- clearInterval(_root["Flallb" + j]);
- AdjustSlides(j);
- j++;
- mmm = 270 * j / Matrix[0].length - 270;
- if(j != Matrix[0].length)
- {
- if(SoundOn && x != GlobalY)
- {
- start_s.start();
- }
- _root["Flallb" + j] = setInterval(FallBegin,Speed,x,j,Matrix);
- }
- else
- {
- bl.removeMovieClip();
- BeginTime = getTimer();
- notStop = redytoend = true;
- ShowBlink();
- if(RoundSity == 0 && RoundCountry == 0 && hbegin)
- {
- hbegin = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,"begin");
- }
- Fall = moveart = hammeruse = false;
- }
- }
- else
- {
- var i = 0;
- while(i < Matrix.length)
- {
- if(mmm < 270)
- {
- TIME.time1._x = mmm;
- }
- eval(FindName(i,j))._y = eval(FindName(i,j))._y + l;
- eval(FindName(i,j))._alpha = 100 - (GlobalY + k * Size - eval(FindName(k,j))._y);
- i++;
- }
- }
- updateAfterEvent();
- }
- function AdjustSlides(j)
- {
- var i = 0;
- while(i <= Matrix.length)
- {
- if(Matrix[i][j].substr(1,3) != "sli")
- {
- eval("s" + i + j)._x = GlobalX + Size * j + Size / 2 - eval("s" + i + j)._width / 2;
- eval("s" + i + j)._y = GlobalY + Size * i + Size / 2 - eval("s" + i + j)._height / 2;
- }
- i++;
- }
- }
- function ShowBlink()
- {
- var k = 0;
- clearInterval(delays);
- delays = setInterval(function()
- {
- var i = 0;
- while(i <= k)
- {
- var j = 0;
- while(j <= k)
- {
- if(i + j == k && Matrix[i][j] != "0" && Matrix[i][j] != undefined)
- {
- _root.attachMovie("shine1","si" + i + j,_root.getNextHighestDepth(),{_x:GlobalX + j * Size,_y:GlobalY + i * Size});
- if(eval("s" + i + j).hitTest(hints))
- {
- eval("si" + i + j).removeMovieClip();
- }
- }
- j++;
- }
- i++;
- }
- if(k == Matrix.length + Matrix[0].length - 2)
- {
- clearInterval(delays);
- notBlock = true;
- }
- else
- {
- k++;
- }
- }
- ,60);
- }
- function DrawArt1(i, j)
- {
- _root.createEmptyMovieClip("s" + i + j,_root.getNextHighestDepth(),{_x:Size * j + GlobalX,_y:Size * i + GlobalY});
- eval("s" + i + j).attachMovie(Matrix[i][j],"mask",eval("s" + i + j).getNextHighestDepth());
- eval("s" + i + j).attachMovie("art","art",eval("s" + i + j).getNextHighestDepth());
- eval("s" + i + j).art._width = eval("s" + i + j).mask._width;
- if(eval("s" + i + j).art._width < Size / 2)
- {
- eval("s" + i + j).art._width = Size * 2 / 3;
- }
- eval("s" + i + j).art._height = eval("s" + i + j).mask._height;
- eval("s" + i + j).art._x = eval("s" + i + j).mask._x = Size / 2 - eval("s" + i + j).art._width / 2;
- eval("s" + i + j).art._y = eval("s" + i + j).mask._y = Size / 2 - eval("s" + i + j).art._height / 2;
- }
- function DrawMatrix(x, y, Matrix)
- {
- i = 0;
- while(i < Matrix.length)
- {
- j = 0;
- while(j < Matrix[i].length)
- {
- if(Matrix[i][j].substr(0,4) != "lock")
- {
- if(Matrix[i][j].substr(1,5) == "slice")
- {
- eval(Matrix[i][j]).removeMovieClip();
- DrawArt1(i,j);
- }
- else if(Matrix[i][j].substr(0,5) != "slide")
- {
- _root.attachMovie(Matrix[i][j],"s" + i + j,_root.getNextHighestDepth());
- }
- else
- {
- _root.attachMovie(Matrix[i][j],"s" + i + j,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
- }
- eval("s" + i + j)._x = x + j * Size;
- eval("s" + i + j)._y = y + i * Size;
- if(Matrix[i][j].substr(1,3) != "sli")
- {
- eval("s" + i + j)._x += Size / 2 - eval("s" + i + j)._width / 2;
- }
- eval("s" + i + j)._alpha = 0;
- InitSlide("s" + i + j);
- if(Matrix[i][j] == "hammer" && hhammer)
- {
- hhammer = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,"hammer");
- }
- else if(Matrix[i][j] == "digger" && hdigger)
- {
- hdigger = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,"digger");
- }
- else if(Matrix[i][j] == "watch" && hwatch)
- {
- hwatch = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,"watch");
- }
- else if(Matrix[i][j] == "lamp" && hlamp)
- {
- hlamp = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,"lamp");
- }
- }
- else
- {
- var Lock = Matrix[i][j].substr(0,5);
- var slide = Matrix[i][j].substr(5,10);
- _root.attachMovie(slide,"s" + i + j,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
- eval("s" + i + j).attachMovie(Lock,"l",_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
- eval("s" + i + j)._alpha = 0;
- eval("s" + i + j)._x = x + j * Size;
- eval("s" + i + j)._y = y + i * Size;
- }
- j++;
- }
- i++;
- }
- mmm = -270;
- if(SoundOn && y != GlobalY)
- {
- start_s.start();
- }
- Flallb0 = setInterval(FallBegin,Speed,y,0,Matrix);
- }
- function InitSlide(slide)
- {
- eval(slide).onPress = Press;
- eval(slide).onRelease = Release;
- eval(slide).onReleaseOutside = Release;
- eval(slide).onRollOver = OverMove;
- eval(slide).onRollOut = OutMove;
- eval(slide).useHandCursor = false;
- eval(slide).tabEnabled = false;
- }
- function DrawFon(x, y, Matrix)
- {
- var l = 0;
- var k = 0;
- i = 0;
- while(i < Matrix.length)
- {
- j = 0;
- while(j < Matrix[i].length)
- {
- if(Matrix[i][j] != "0")
- {
- _root.attachMovie("fon","s" + i + j + "fon",_root.getNextHighestDepth(),{_width:Size,_height:Size});
- eval("s" + i + j + "fon")._x = j * Size + x;
- eval("s" + i + j + "fon")._y = i * Size + y;
- eval("s" + i + j + "fon").gotoAndStop(1);
- eval("s" + i + j + "fon")._width = Size + 1;
- eval("s" + i + j + "fon")._height = Size + 1;
- if(Matrix[i - 1][j] == "0" || Matrix[i - 1][j] == undefined)
- {
- _root.attachMovie("border","border" + l,_root.getNextHighestDepth(),{_height:Size});
- eval("border" + l)._rotation = -90;
- eval("border" + l)._x = j * Size + x;
- eval("border" + l)._y = i * Size + y - 2;
- l++;
- if(Matrix[i][j - 1] == "0" || Matrix[i][j - 1] == undefined)
- {
- _root.attachMovie("corner","corner" + k,_root.getNextHighestDepth(),{_x:j * Size + x - 5,_y:i * Size + y - 5});
- k++;
- }
- if(Matrix[i][j + 1] == "0" || Matrix[i][j + 1] == undefined)
- {
- _root.attachMovie("corner","corner" + k,_root.getNextHighestDepth(),{_x:(j + 1) * Size + x + 5.5,_y:i * Size + y - 5,_rotation:90});
- k++;
- }
- }
- if(Matrix[i + 1][j] == "0" || Matrix[i + 1][j] == undefined)
- {
- _root.attachMovie("border","border" + l,_root.getNextHighestDepth(),{_height:Size});
- eval("border" + l)._rotation = -90;
- eval("border" + l)._x = j * Size + x;
- eval("border" + l)._y = (i + 1) * Size + y + 3;
- l++;
- if(Matrix[i][j - 1] == "0" || Matrix[i][j - 1] == undefined)
- {
- _root.attachMovie("corner","corner" + k,_root.getNextHighestDepth(),{_x:j * Size + x + 0,_y:(i + 1) * Size + y,_rotation:90});
- k++;
- }
- if(Matrix[i][j + 1] == "0" || Matrix[i][j + 1] == undefined)
- {
- _root.attachMovie("corner","corner" + k,_root.getNextHighestDepth(),{_x:(j + 1) * Size + x + 0.5,_y:(i + 1) * Size + y});
- k++;
- }
- }
- if(Matrix[i][j - 1] == "0" || Matrix[i][j - 1] == undefined)
- {
- _root.attachMovie("border","border" + l,_root.getNextHighestDepth(),{_height:Size});
- eval("border" + l)._x = j * Size + x - 2;
- eval("border" + l)._y = i * Size + y;
- l++;
- }
- if(Matrix[i][j + 1] == "0" || Matrix[i][j + 1] == undefined)
- {
- _root.attachMovie("border","border" + l,_root.getNextHighestDepth(),{_height:Size});
- eval("border" + l)._x = (j + 1) * Size + x + 3;
- eval("border" + l)._y = i * Size + y;
- l++;
- }
- }
- j++;
- }
- i++;
- }
- bl._alpha = 0;
- DrawMatrix(GlobalX,GlobalY - 100,Matrix);
- }
- function generateMatrix(country, sity, Matrix)
- {
- Line = new Array();
- agame = map[country][sity];
- i = 0;
- while(i < agame.length)
- {
- j = 0;
- while(j < agame[i].length)
- {
- if(agame[i][j] == 1)
- {
- do
- {
- done = true;
- var temp1 = Math.round(Math.random() * (Nomer - 1)) + 1;
- var temp = "slide" + temp1;
- if(i > 1 && (Matrix[i - 1][j] == temp || Matrix[i - 1][j].substr(5,10) == temp) && (Matrix[i - 2][j] == temp || Matrix[i - 2][j].substr(5,10) == temp))
- {
- done = false;
- }
- if(j > 1 && (Line[j - 1] == temp || Line[j - 1].substr(5,10) == temp) && (Line[j - 2] == temp || Line[j - 2].substr(5,10) == temp))
- {
- done = false;
- }
- if(agame[i][j + 1].substr(1,1) == temp1 || agame[i + 1][j].substr(1,1) == temp1)
- {
- done = false;
- }
- }
- while(!done);
-
- Line[j] = temp;
- }
- else
- {
- switch(agame[i][j].substr(0,1))
- {
- case "x":
- temp = "lock1slide" + agame[i][j].substr(1,1);
- break;
- case "X":
- temp = "lock2slide" + agame[i][j].substr(1,1);
- break;
- case "b":
- lala = agame[i][j].substr(1,1);
- if(lala == "1")
- {
- temp = "hammer";
- }
- else if(lala == "2")
- {
- temp = "digger";
- }
- else if(lala == "3")
- {
- temp = "watch";
- }
- else if(lala == "4")
- {
- temp = "lamp";
- }
- break;
- case "a":
- temp = countries[country].toLowerCase().substr(0,1) + "slice" + agame[i][j].substr(1,2);
- eval(temp).removeMovieClip();
- break;
- default:
- temp = "0";
- }
- Line[j] = temp;
- }
- j++;
- }
- Matrix[i] = Line;
- Line = new Array();
- i++;
- }
- }
- function FindIndexX(name)
- {
- var _loc1_ = name.substr(name.indexOf("s") + 2,1);
- return _loc1_;
- }
- function FindIndexY(name)
- {
- var _loc1_ = name.substr(name.indexOf("s") + 3,2);
- return _loc1_;
- }
- function FindName(x, y)
- {
- return "s" + x + y;
- }
- function CheckClick(name)
- {
- Release();
- if(Blink == "no")
- {
- return true;
- }
- notBlock = false;
- i = FindIndexX(String(name));
- j = FindIndexY(String(name));
- var _loc1_ = String(Blink);
- ind1 = FindIndexX(_loc1_);
- ind2 = FindIndexY(_loc1_);
- if(i - ind1 == 1 && j - ind2 == 0)
- {
- CheckSuccess(i,j,ind1,ind2);
- MoveDown(_loc1_);
- }
- else if(i - ind1 == -1 && j - ind2 == 0)
- {
- CheckSuccess(i,j,ind1,ind2);
- MoveUp(_loc1_);
- }
- else if(i - ind1 == 0 && j - ind2 == -1)
- {
- CheckSuccess(i,j,ind1,ind2);
- MoveLeft(_loc1_);
- }
- else if(i - ind1 == 0 && j - ind2 == 1)
- {
- CheckSuccess(i,j,ind1,ind2);
- MoveRight(_loc1_);
- }
- else
- {
- if(i - ind1 == 0 && j - ind2 == 0)
- {
- notBlock = true;
- return true;
- }
- notBlock = true;
- Blink.gotoAndStop(1);
- return true;
- }
- }
- function MovingDown(slide, y, chk)
- {
- var _loc6_ = y + Size;
- if(slide._y < _loc6_ - N)
- {
- if(chk == "fall")
- {
- Fall = true;
- }
- slide._y += N;
- }
- else
- {
- if(chk == "0")
- {
- notBlock = true;
- }
- Fall = false;
- var _loc3_ = FindIndexX(String(slide));
- var _loc2_ = FindIndexY(String(slide));
- _loc3_;
- var _loc4_ = FindName(_loc3_++,_loc2_);
- var _loc7_ = FindName(_loc3_,_loc2_);
- RemoveSlides(_loc4_,_loc7_,chk);
- }
- updateAfterEvent();
- }
- function MovingRight(slide, x, chk)
- {
- var _loc5_ = x + Size;
- if(slide._x < _loc5_ - N)
- {
- slide._x += N;
- }
- else
- {
- if(chk == "0")
- {
- notBlock = true;
- }
- var _loc3_ = FindIndexX(String(slide));
- var _loc2_ = FindIndexY(String(slide));
- _loc2_;
- var _loc4_ = FindName(_loc3_,_loc2_++);
- var _loc6_ = FindName(_loc3_,_loc2_);
- RemoveSlides(_loc4_,_loc6_,chk);
- }
- updateAfterEvent();
- }
- function MovingLeft(slide, x, chk)
- {
- var _loc5_ = x - Size;
- if(slide._x > _loc5_ + N)
- {
- slide._x -= N;
- }
- else
- {
- if(chk == "0")
- {
- notBlock = true;
- }
- var _loc3_ = FindIndexX(String(slide));
- var _loc2_ = FindIndexY(String(slide));
- _loc2_;
- var _loc4_ = FindName(_loc3_,_loc2_--);
- var _loc6_ = FindName(_loc3_,_loc2_);
- RemoveSlides(_loc4_,_loc6_,chk);
- }
- updateAfterEvent();
- }
- function MovingUp(slide, y, chk)
- {
- var End = y - Size;
- if(eval(slide)._y > End + N)
- {
- eval(slide)._y -= N;
- }
- else
- {
- if(chk == "0")
- {
- notBlock = true;
- }
- var i = FindIndexX(String(slide));
- var j = FindIndexY(String(slide));
- var temp = FindName(i--,j);
- var temp1 = FindName(i,j);
- RemoveSlides(temp,temp1,chk);
- }
- updateAfterEvent();
- }
- function RemoveSlides(slide, slide1, chk)
- {
- StopHint();
- redytoend = false;
- eval(slide + "fon").gotoAndStop(1);
- eval(slide1 + "fon").gotoAndStop(1);
- Blink = "no";
- clearInterval(_root["m" + String(eval(slide))]);
- clearInterval(_root["m" + String(eval(slide1))]);
- removeMovieClip(eval(slide));
- removeMovieClip(eval(slide1));
- var i = FindIndexX(String(slide));
- var j = FindIndexY(String(slide));
- var i1 = FindIndexX(String(slide1));
- var j1 = FindIndexY(String(slide1));
- if(chk == "fall")
- {
- i++;
- var slide = FindName(i,j);
- if(Matrix[i][j].substr(0,4) != "lock")
- {
- if(Matrix[i][j].substr(1,5) == "slice")
- {
- DrawArt1(i,j);
- }
- else if(Matrix[i][j].substr(0,5) != "slide")
- {
- _root.attachMovie(Matrix[i][j],slide,_root.getNextHighestDepth());
- slide._x += Size / 2 - slide._width / 2;
- slide._y += Size / 2 - slide._height / 2;
- }
- else
- {
- _root.attachMovie(Matrix[i][j],slide,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
- }
- InitSlide(slide);
- }
- else
- {
- var Lock = Matrix[i][j].substr(0,5);
- var slid = Matrix[i][j].substr(5,10);
- _root.attachMovie(slid,slide,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
- eval(slide).attachMovie(Lock,"l",_root.getNextHighestDepth());
- }
- eval(slide)._x = GlobalX + j * Size;
- eval(slide)._y = GlobalY + i * Size;
- if(Matrix[i][j].substr(0,5) != "slide")
- {
- slide._x += Size / 2 - slide._width / 2;
- slide._y += Size / 2 - slide._height / 2;
- }
- }
- else
- {
- var newname = Matrix[i1][j1];
- Matrix[i1][j1] = Matrix[i][j];
- Matrix[i][j] = newname;
- if(Matrix[i][j].substr(1,5) == "slice")
- {
- DrawArt1(i,j);
- }
- else if(Matrix[i][j].substr(0,5) != "slide")
- {
- _root.attachMovie(Matrix[i][j],slide,_root.getNextHighestDepth());
- }
- else
- {
- _root.attachMovie(Matrix[i][j],slide,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
- }
- InitSlide(slide);
- if(Matrix[i1][j1].substr(1,5) == "slice")
- {
- DrawArt1(i1,j1);
- }
- else if(Matrix[i1][j1].substr(0,5) != "slide")
- {
- _root.attachMovie(Matrix[i1][j1],slide1,_root.getNextHighestDepth());
- }
- else
- {
- _root.attachMovie(Matrix[i1][j1],slide1,_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
- }
- InitSlide(slide1);
- eval(slide)._x = GlobalX + j * Size;
- eval(slide)._y = GlobalY + i * Size;
- eval(slide1)._x = GlobalX + j1 * Size;
- eval(slide1)._y = GlobalY + i1 * Size;
- if(Matrix[i][j].substr(1,3) != "sli")
- {
- eval(slide)._x += Size / 2 - eval(slide)._width / 2;
- eval(slide)._y += Size / 2 - eval(slide)._height / 2;
- }
- if(Matrix[i1][j1].substr(1,3) != "sli")
- {
- eval(slide1)._x += Size / 2 - eval(slide1)._width / 2;
- eval(slide1)._y += Size / 2 - eval(slide1)._height / 2;
- }
- if(chk != "0")
- {
- var done = FindChain(Matrix);
- if(!done)
- {
- if(hswap)
- {
- hswap = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,"swap");
- }
- if(i > i1)
- {
- MoveUp(slide,0);
- }
- else if(i1 > i)
- {
- MoveUp(slide1,0);
- }
- else if(j1 > j)
- {
- MoveLeft(slide1,0);
- }
- else
- {
- MoveLeft(slide,0);
- }
- }
- else
- {
- if(SoundOn)
- {
- match1_s.start();
- }
- Matches++;
- fallnext = setInterval(function()
- {
- clearInterval(fallnext);
- fall = setInterval(FallDown,Speed,Matrix);
- }
- ,100);
- if(hart)
- {
- hart = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,"art");
- }
- }
- }
- else
- {
- redytoend = true;
- }
- }
- StartHint();
- }
- function StopHint()
- {
- clearInterval(stopping);
- sh1.removeMovieClip();
- sh2.removeMovieClip();
- }
- function GoHint(i1, j1, i2, j2)
- {
- StopHint();
- _root.attachMovie("shine","sh1",_root.getNextHighestDepth());
- _root.attachMovie("shine","sh2",_root.getNextHighestDepth());
- sh1._x = GlobalX + j1 * Size - 2;
- sh1._y = GlobalY + i1 * Size - 2;
- sh2._x = GlobalX + j2 * Size - 2;
- sh2._y = GlobalY + i2 * Size - 2;
- }
- function CHECK(i, j, i0, j0, i1, j1, i2, j2, chk)
- {
- var _loc4_ = false;
- var _loc1_ = Matrix[i][j];
- if(Matrix[i][j] != "0" && Matrix[i0][j0] != "0" && Matrix[i0][j0] != undefined && Matrix[i0][j0].substr(0,1) != "l" && (Matrix[i1][j1] == _loc1_ || Matrix[i1][j1].substr(5,10) == _loc1_) && (Matrix[i2][j2] == _loc1_ || Matrix[i2][j2].substr(5,10) == _loc1_))
- {
- _loc4_ = true;
- if(chk == undefined)
- {
- GoHint(i,j,i0,j0);
- }
- }
- return _loc4_;
- }
- function Finding(i, j, i1, j1)
- {
- var _loc3_ = false;
- if(!_loc3_ && (i1 == i && j1 == Number(j) + 1 || i1 == undefined))
- {
- _loc3_ = CHECK(Number(i),j,Number(i),Number(j) + 1,Number(i) + 1,Number(j) + 1,Number(i) + 2,Number(j) + 1);
- }
- if(!_loc3_ && (i1 == i && j1 == j - 1 || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i,Number(j) - 1,Number(i) + 1,Number(j) - 1,Number(i) + 2,Number(j) - 1);
- }
- if(!_loc3_ && (i1 == i && j1 == Number(j) + 1 || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i,Number(j) + 1,i - 1,Number(j) + 1,i - 2,Number(j) + 1);
- }
- if(!_loc3_ && (i1 == i && j1 == j - 1 || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i,Number(j) - 1,i - 1,Number(j) - 1,i - 2,Number(j) - 1);
- }
- if(!_loc3_ && (i1 == Number(i) + 1 && j1 == j || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),Number(i) + 1,Number(j),Number(i) + 1,Number(j) + 1,Number(i) + 1,Number(j) + 2);
- }
- if(!_loc3_ && (i1 == Number(i) + 1 && j1 == j || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),Number(i) + 1,Number(j),Number(i) + 1,Number(j) - 1,Number(i) + 1,Number(j) - 2);
- }
- if(!_loc3_ && (i1 == i - 1 && j1 == j || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i - 1,Number(j),i - 1,Number(j) + 1,i - 1,Number(j) + 2);
- }
- if(!_loc3_ && (i1 == i - 1 && j1 == j || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i - 1,Number(j),i - 1,Number(j) - 1,i - 1,Number(j) - 2);
- }
- if(!_loc3_ && (i1 == i && j1 == Number(j) + 1 || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i,Number(j) + 1,i - 1,Number(j) + 1,Number(i) + 1,Number(j) + 1);
- }
- if(!_loc3_ && (i1 == i && j1 == j - 1 || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i,Number(j) - 1,i - 1,Number(j) - 1,Number(i) + 1,Number(j) - 1);
- }
- if(!_loc3_ && (i1 == Number(i) + 1 && j1 == j || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),Number(i) + 1,Number(j),Number(i) + 1,Number(j) + 1,Number(i) + 1,Number(j) - 1);
- }
- if(!_loc3_ && (i1 == i - 1 && j1 == j || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i - 1,Number(j),i - 1,Number(j) + 1,i - 1,Number(j) - 1);
- }
- if(!_loc3_ && (i1 == i - 1 && j1 == j || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i - 1,Number(j),i - 2,Number(j),i - 3,Number(j));
- }
- if(!_loc3_ && (i1 == Number(i) + 1 && j1 == j || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),Number(i) + 1,Number(j),Number(i) + 2,Number(j),Number(i) + 3,Number(j));
- }
- if(!_loc3_ && (i1 == i && j1 == j - 1 || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i,Number(j) - 1,i,Number(j) - 2,i,Number(j) - 3);
- }
- if(!_loc3_ && (i1 == i && j1 == Number(j) + 1 || i1 == undefined))
- {
- _loc3_ = CHECK(i,Number(j),i,Number(j) + 1,i,Number(j) + 2,i,Number(j) + 3);
- }
- return _loc3_;
- }
- function StartHint()
- {
- clearInterval(stopping);
- stopping = setInterval(FindStop,7000,Matrix);
- }
- function FindStop(Matrix, chk)
- {
- if(notBlock)
- {
- clearInterval(stopping);
- var _loc7_ = 0;
- var _loc6_ = 0;
- notStop = false;
- _loc7_ = Math.round(Math.random() * (Matrix.length - 1));
- _loc6_ = Math.round(Math.random() * (Matrix[0].length - 1));
- var _loc5_ = 0;
- while(_loc5_ < Matrix.length)
- {
- var _loc2_ = (_loc7_ + _loc5_) % Matrix.length;
- var _loc1_ = 0;
- while(_loc1_ < Matrix[_loc2_].length)
- {
- var _loc4_ = (_loc6_ + _loc1_) % Matrix[0].length;
- notStop = Finding(_loc2_,_loc4_);
- if(notStop)
- {
- return _loc2_;
- }
- _loc1_ = _loc1_ + 1;
- }
- _loc5_ = _loc5_ + 1;
- }
- if(!notStop)
- {
- GameOver();
- }
- }
- }
- function FALL(Name, y0, Y, t0)
- {
- var time = getTimer();
- var T = GameSpeed;
- Name._y = y0 - (time - t0) * (y0 - Y) / T;
- if(Name._alpha < 100)
- {
- Name._alpha = (time - t0) * 100 / T;
- }
- if(time > t0 + T)
- {
- Name._y = Y;
- Name._alpha = 100;
- clearInterval(_root["m" + String(eval(Name))]);
- }
- }
- function CheckFall()
- {
- clearInterval(fall);
- clearInterval(refreshing);
- Chain++;
- if(FindChain(Matrix))
- {
- if(SoundOn)
- {
- match2_s.start();
- }
- fall = setInterval(FallDown,200,Matrix);
- }
- else if(LastArt())
- {
- fall = setInterval(FallDown,200,Matrix);
- }
- else
- {
- Fall = false;
- if(Chain > MaxChain)
- {
- MaxChain = Chain;
- }
- Chain = 0;
- notBlock = true;
- redytoend = true;
- StartHint();
- }
- }
- function LastArt()
- {
- var _loc2_ = false;
- j = 0;
- while(j < Matrix[0].length)
- {
- var _loc1_ = Matrix.length - 1;
- temp = Matrix[_loc1_][j];
- while(temp == "0")
- {
- _loc1_ = _loc1_ - 1;
- temp = Matrix[_loc1_][j];
- }
- if(temp.substr(1,5) == "slice" || temp == "lamp" || temp == "hammer" || temp == "watch" || temp == "digger")
- {
- _loc2_ = true;
- }
- j++;
- }
- return _loc2_;
- }
- function FallDown(Matrix)
- {
- function FallColomn(j)
- {
- var N = 0;
- var i = Matrix.length - 1;
- while(i >= 0)
- {
- if(Matrix[i][j] != "0")
- {
- if(Matrix[i][j] == "no")
- {
- N++;
- }
- else if((Matrix[i][j].substr(1,5) == "slice" || Matrix[i][j] == "hammer" || Matrix[i][j] == "digger" || Matrix[i][j] == "watch" || Matrix[i][j] == "lamp") && (Matrix[i + 1][j] == undefined || Matrix[i + 1][j] == "0"))
- {
- Falling = true;
- N++;
- var temp = Matrix[i][j];
- MoveArt(i,j,temp);
- Matrix[i][j] = "no";
- }
- else if(N)
- {
- var slide = FindName(i,j);
- var X = eval(slide)._x;
- var Y = eval(slide)._y;
- var Name = Matrix[i][j];
- eval(slide).removeMovieClip();
- var k = i + N;
- slide = "s" + k + j;
- if(Name.substr(0,4) != "lock")
- {
- if(Name.substr(1,5) == "slice")
- {
- _root.createEmptyMovieClip(slide,_root.getNextHighestDepth());
- eval(slide).attachMovie(Name,"mask",eval(slide).getNextHighestDepth());
- eval(slide).attachMovie("art","art",eval(slide).getNextHighestDepth());
- eval(slide).art._width = eval(slide).mask._width;
- eval(slide).art._height = eval(slide).mask._height;
- if(eval(slide).art._width < Size / 2)
- {
- eval(slide).art._width = Size * 2 / 3;
- }
- eval(slide).art._x = eval(slide).mask._x = Size / 2 - eval(slide).art._width / 2;
- eval(slide).art._y = eval(slide).mask._y = Size / 2 - eval(slide).art._height / 2;
- eval(slide)._x = X;
- eval(slide)._y = Y;
- }
- else if(Name.substr(0,5) != "slide")
- {
- _root.attachMovie(Name,slide,_root.getNextHighestDepth(),{_x:X,_y:Y});
- }
- else
- {
- _root.attachMovie(Name,slide,_root.getNextHighestDepth(),{_x:X,_y:Y,_width:Size1,_height:Size1});
- }
- InitSlide(slide);
- }
- else
- {
- var Lock = Name.substr(0,5);
- var slid = Name.substr(5,10);
- _root.attachMovie(slid,slide,_root.getNextHighestDepth(),{_x:X,_y:Y,_width:Size1,_height:Size1});
- eval(slide).attachMovie(Lock,"l",_root.getNextHighestDepth(),{_width:Size1,_height:Size1});
- }
- Matrix[k][j] = Matrix[i][j];
- Matrix[i][j] = "no";
- clearInterval(_root["m" + String(eval(slide))]);
- _root["m" + String(eval(slide))] = setInterval(FALL,0,eval(slide),Y,Y + N * Size,getTimer());
- }
- }
- i--;
- }
- var l = 0;
- while(Matrix[l][j] == "0")
- {
- l++;
- }
- i = 0;
- while(i < N)
- {
- k = i + l;
- var Name = "slide" + Math.round(Math.random() * (Nomer - 1) + 1);
- Matrix[k][j] = Name;
- var X = GlobalX + j * Size;
- var Y = GlobalY - (N - k) * Size;
- _root.attachMovie(Name,"s" + k + j,_root.getNextHighestDepth(),{_x:X,_y:Y,_alpha:0,_width:Size1,_height:Size1});
- eval("s" + k + j)._x += Size / 2 - eval("s" + k + j)._width / 2;
- Name = "s" + k + j;
- clearInterval(_root["m" + String(eval(Name))]);
- InitSlide(Name);
- _root["m" + String(eval(Name))] = setInterval(FALL,0,eval(Name),Y,Y + N * Size + Size / 2 - eval(Name)._height / 2,getTimer());
- i++;
- }
- }
- clearInterval(fall);
- notBlock = false;
- clearInterval(refreshing);
- refreshing = setInterval(function()
- {
- updateAfterEvent();
- }
- ,0);
- Fall = true;
- StopHint();
- var j = 0;
- while(j < Matrix[0].length)
- {
- FallColomn(j);
- j++;
- }
- fall = setInterval(CheckFall,GameSpeed + 50);
- }
- function MoveArt(i, j, Name)
- {
- var temp = Name;
- if(Name == "hammer" && Hammer)
- {
- Name = "a" + Name;
- }
- else if(Name == "digger" && Digger)
- {
- Name = "a" + Name;
- }
- else if(Name == "watch" && Watch)
- {
- Name = "a" + Name;
- }
- else if(Name == "lamp" && Lamp)
- {
- Name = "a" + Name;
- }
- moveart = true;
- var End = GlobalY + (i + 2.5) * Size;
- var slide = FindName(i,j);
- _root.attachMovie(temp,Name,_root.getNextHighestDepth());
- eval(Name)._x = eval(slide)._x + 15 - eval(slide)._width / 2;
- eval(Name)._y = eval(slide)._y + 15 - eval(slide)._height / 2;
- eval(slide).removeMovieClip();
- if(Name.substr(1,5) == "slice")
- {
- var EndX = ArtPos[Number(Name.substr(6,2))].x;
- var EndY = ArtPos[Number(Name.substr(6,2))].y;
- }
- else if(temp == "hammer")
- {
- var EndX = HamX;
- var EndY = HamY;
- Hammer++;
- hmove = setInterval(function()
- {
- clearInterval(hmove);
- TextShow(hamn,"x" + Hammer,"h",0,0,0);
- eval(Name).onPress = onHammerClick;
- }
- ,bonus_s.duration - 1100);
- }
- else if(temp == "digger")
- {
- Digger++;
- var EndX = DigX;
- var EndY = DigY;
- dmove = setInterval(function()
- {
- clearInterval(dmove);
- TextShow(dign,"x" + Digger,"h",0,0,0);
- eval(Name).onPress = onDiggerClick;
- }
- ,bonus_s.duration - 1100);
- }
- else if(temp == "watch")
- {
- Watch++;
- var EndX = WatX;
- var EndY = WatY;
- wmove = setInterval(function()
- {
- clearInterval(wmove);
- TextShow(watn,"x" + Watch,"h",0,0,0);
- eval(Name).onPress = onWatchClick;
- }
- ,bonus_s.duration - 1100);
- }
- else if(temp == "lamp")
- {
- Lamp++;
- var EndX = LamX;
- var EndY = LamY;
- lmove = setInterval(function()
- {
- clearInterval(lmove);
- TextShow(lamn,"x" + Lamp,"h",0,0,0);
- eval(Name).onPress = onLampClick;
- }
- ,bonus_s.duration - 1100);
- }
- var a;
- var b;
- var c;
- var x1;
- var x2;
- var x3;
- var y1;
- var y2;
- var y3 = 0;
- x3 = EndX - 3;
- y3 = EndY - 3;
- x2 = eval(Name)._x;
- y2 = eval(Name)._y;
- if(x2 < 400)
- {
- x1 = 200;
- }
- else
- {
- x1 = 270;
- }
- y1 = 300;
- a = ((y2 - y1) / (x2 - x1) - (y3 - y1) / (x3 - x1)) / (x2 - x3);
- b = (y2 - y1) / (x2 - x1) - a * (x2 + x1);
- c = y1 - a * x1 * x1 - b * x1;
- if(temp.substr(1,5) == "slice")
- {
- if(SoundOn)
- {
- art_s.start();
- watch_s.start();
- }
- snd = 2900;
- }
- else
- {
- snd = bonus_s.duration - 1100;
- if(SoundOn)
- {
- bonus_s.start();
- }
- }
- var i = 10;
- _root["TAIL" + Name] = setInterval(function()
- {
- if(i < NumTail)
- {
- _root.attachMovie("tail","tail" + i + Name,_root.getNextHighestDepth(),{_x:eval(Name)._x + Math.random() * 20,_y:eval(Name)._y + Math.random() * 20});
- i++;
- }
- else
- {
- clearInterval(_root["TAIL" + Name]);
- }
- }
- ,TailPeriod);
- AddingTime = 0;
- clearInterval(AddT);
- AddT = setInterval(AddTime,50,snd / 20);
- _root[MATP + Name] = setInterval(MoveArtToPosition,Speed,Name,temp,x3,y3,a,b,c,getTimer(),x2,snd);
- }
- function MoveArtToPosition(Name, temp, EndX, EndY, a, b, c, Time, x2, snd)
- {
- moveart = true;
- var Done = false;
- var Time1 = getTimer();
- if(Time1 - Time >= snd)
- {
- Done = true;
- }
- else
- {
- var l = x2 - (Time1 - Time) * (x2 - EndX) / snd;
- var m = l;
- eval(Name)._x = l;
- eval(Name)._y = a * l * l + b * l + c;
- }
- if(Done)
- {
- clearInterval(_root[MATP + Name]);
- clearInterval(_root["aaa" + Name]);
- _root["aaa" + Name] = setInterval(function()
- {
- var i = 10;
- while(i < NumTail)
- {
- eval("tail" + i + Name).removeMovieClip();
- i++;
- }
- clearInterval(_root["aaa" + Name]);
- clearInterval(TAIL);
- eval(Name)._x = EndX + 3;
- eval(Name)._y = EndY + 3;
- moveart = false;
- eval("a" + temp).removeMovieClip();
- eval(Name).fon.removeMovieClip();
- ArtPos[Number(Name.substr(6,2))].is = true;
- CheckEnd(Matrix);
- if(_root["h" + temp + "2"])
- {
- _root["h" + temp + "2"] = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,temp + "2");
- }
- }
- ,300);
- }
- updateAfterEvent();
- }
- function CheckEnd(Matrix)
- {
- var _loc4_ = true;
- var _loc2_ = 0;
- while(_loc2_ < Matrix.length)
- {
- var _loc1_ = 0;
- while(_loc1_ < Matrix[_loc2_].length)
- {
- if(Matrix[_loc2_][_loc1_].substr(1,5) == "slice")
- {
- _loc4_ = false;
- break;
- }
- _loc1_ = _loc1_ + 1;
- }
- _loc2_ = _loc2_ + 1;
- }
- if(_loc4_)
- {
- clearInterval(ER);
- ER = setInterval(EndRound,20,Matrix);
- }
- else if(hart2)
- {
- hart2 = false;
- clearInterval(HHH);
- HHH = setInterval(Hints,50,"art2");
- }
- }
- function EndRound(Matrix)
- {
- if(moveart && !notBlock)
- {
- clearInterval(ER);
- }
- else if(redytoend && notBlock && !moveart)
- {
- notBlock = false;
- clearInterval(ER);
- RoundSity++;
- if(RoundSity == 9 || RoundCountry == 1 && RoundSity == 8 || RoundCountry == 0 && RoundSity == 6)
- {
- RoundSity = 0;
- }
- FromHint();
- StopTimer();
- bl.removeMovieClip();
- inMenu = false;
- mainmenu.removeMovieClip();
- EEE = getTimer();
- EndTime = Math.abs(Math.round((EndTime - EEE) / 1000));
- TimeBonus = 0;
- endstring = Matrix.length;
- bl.removeMovieClip();
- _root.attachMovie("black","bl",_root.getNextHighestDepth());
- bl._width = 520;
- bl._height = 390;
- bl._alpha = 0;
- bl.useHandCursor = false;
- bl.onPress = function()
- {
- clearInterval(endinground);
- endinground = setInterval(function()
- {
- clearInterval(endinground);
- var i = 0;
- while(i < Matrix.length)
- {
- var j = 0;
- while(j < Matrix[0].length)
- {
- eval("s" + i + j).removeMovieClip();
- j++;
- }
- i++;
- }
- clearInterval(ending);
- bigtext.removeMovieClip();
- endstring = 0;
- TIME.time1._x = -270;
- score += EndTime * 10 + Add;
- TextShow(SCORE,String(score),"sc",0,0,1);
- if(score >= NextLife)
- {
- Life++;
- if(SoundOn)
- {
- life_s.start();
- }
- NextLife += 35000;
- }
- TimeBonus += Add + EndTime * 10;
- Add = 0;
- ShowStats();
- }
- ,800);
- };
- clearInterval(ending);
- var str = normal;
- if(EndTime >= 4 * totaltime / 5000)
- {
- str = fast;
- }
- else if(EndTime <= totaltime / 5000)
- {
- str = slow;
- }
- if(RoundSity == 100)
- {
- str = textgameover;
- }
- bigtext.removeMovieClip();
- _root.attachMovie("bigtext","bigtext",_root.getNextHighestDepth(),{_x:360,_y:180});
- TextShow(bigtext,str,"t",5,20,1);
- ending = setInterval(Ending,200,"r");
- }
- }
- function Ending(chk)
- {
- notBlock = false;
- if(chk == "r")
- {
- endstring--;
- if(endstring == -1)
- {
- clearInterval(ending);
- if(SoundOn)
- {
- time_s.start();
- }
- ending = setInterval(Ending,0);
- }
- else
- {
- if(SoundOn && endstring > 0)
- {
- endexplode_s.start();
- }
- var j = 0;
- while(j < Matrix[0].length)
- {
- if(eval("s" + endstring + j) != undefined)
- {
- _root.attachMovie("blow","s" + endstring + j,_root.getNextHighestDepth(),{_x:GlobalX + Size * j - 2,_y:GlobalY + Size * endstring - 2});
- }
- eval("s" + endstring + j).removeMovieClip();
- eval("s" + endstring + j + "fon").gotoAndStop(1);
- j++;
- }
- }
- }
- else if(EndTime <= 0)
- {
- clearInterval(ending);
- bigtext.removeMovieClip();
- time_s.stop();
- clearInterval(endinground);
- stats1 = setInterval(ShowStats,100);
- }
- else
- {
- EndTime -= 2;
- var temp = 100 * (EndTime * 1000) / totaltime;
- TIME.time1._x = (temp - 100) * 270 / 100;
- TimeBonus += 20;
- if(SoundOn)
- {
- scores_s.start();
- }
- Score(20,"y");
- }
- updateAfterEvent();
- }
- function ShowStats()
- {
- if(Add == 0)
- {
- if(SoundOn)
- {
- stats_s.start();
- }
- bl.removeMovieClip();
- clearInterval(stats1);
- stats.removeMovieClip();
- _root.attachMovie("black","bl",_root.getNextHighestDepth());
- _root.attachMovie("statspanel","stats",_root.getNextHighestDepth());
- bl._alpha = 50;
- bl._width = 520;
- bl._height = 390;
- stats._x = 200;
- stats._y = 100;
- bl.onPress = AAA;
- bl.useHandCursor = false;
- TextShow(stats.txt01,texttiles,"h",0,0,0);
- TextShow(stats.txt02,textmatches,"h",0,0,0);
- TextShow(stats.txt03,textchain,"h",0,0,0);
- TextShow(stats.txt04,texttime,"h",0,0,0);
- TextShow(stats.txt05,textbonus,"h",0,0,0);
- TextShow(stats.txt06,textscore,"h",0,0,0);
- TextShow(stats.txt1,String(Tiles),"h",-1,0,2);
- TextShow(stats.txt2,String(Matches),"h",-1,0,2);
- TextShow(stats.txt3,String(MaxChain),"h",-1,0,2);
- TextShow(stats.txt4,String(Math.round((EEE - BeginTime) / 1000) + textseconds),"h",-1,0,2);
- TextShow(stats.txt5,String(TimeBonus),"h",-1,0,2);
- TextShow(stats.txt6,String(score),"h",-1,0,2);
- }
- }
- function ShowNag()
- {
- ClearRound(Matrix);
- if(RoundSity == 100)
- {
- _root.attachMovie("nag","nag",_root.getNextHighestDepth());
- }
- else if(nagtime == 0 && RoundSity == 0)
- {
- _root.attachMovie("endscreen","screen",_root.getNextHighestDepth());
- }
- else if(nagtime && RoundSity % nagtime == 0)
- {
- RedyToPlay = false;
- _root.attachMovie("nag","nag",_root.getNextHighestDepth());
- Start = setInterval(function()
- {
- if(RedyToPlay)
- {
- clearInterval(Start);
- if(RoundSity != 0)
- {
- InitRound();
- }
- else
- {
- _root.attachMovie("endscreen","screen",_root.getNextHighestDepth());
- }
- }
- }
- ,50);
- }
- else
- {
- InitRound();
- }
- }
- function MoveUp(slide, chk)
- {
- var i = FindIndexX(String(slide));
- var j = FindIndexY(String(slide));
- i--;
- if(Matrix[i][j] != "0" && Matrix[i][j] != undefined && Matrix[i][j].substr(0,4) != "lock")
- {
- slide1 = FindName(i,j);
- _root["m" + String(eval(slide))] = setInterval(MovingUp,Speed,eval(slide),eval(slide)._y,chk);
- _root["m" + String(eval(slide1))] = setInterval(MovingDown,Speed,eval(slide1),eval(slide1)._y,chk);
- }
- else
- {
- notBlock = true;
- }
- }
- function MoveDown(slide, chk)
- {
- var i = FindIndexX(String(slide));
- var j = FindIndexY(String(slide));
- i++;
- if(Matrix[i][j] != "0" && Matrix[i][j] != undefined && Matrix[i][j].substr(0,4) != "lock")
- {
- slide1 = FindName(i,j);
- _root["m" + String(eval(slide))] = setInterval(MovingDown,Speed,eval(slide),eval(slide)._y,chk);
- _root["m" + String(eval(slide1))] = setInterval(MovingUp,Speed,eval(slide1),eval(slide1)._y,chk);
- }
- else
- {
- notBlock = true;
- }
- }
- function MoveLeft(slide, chk)
- {
- var i = FindIndexX(String(slide));
- var j = FindIndexY(String(slide));
- j--;
- if(Matrix[i][j] != "0" && Matrix[i][j] != undefined && Matrix[i][j].substr(0,4) != "lock")
- {
- slide1 = FindName(i,j);
- _root["m" + String(eval(slide))] = setInterval(MovingLeft,Speed,eval(slide),eval(slide)._x,chk);
- _root["m" + String(eval(slide1))] = setInterval(MovingRight,Speed,eval(slide1),eval(slide1)._x,chk);
- }
- else
- {
- notBlock = true;
- }
- }
- function MoveRight(slide, chk)
- {
- var i = FindIndexX(String(slide));
- var j = FindIndexY(String(slide));
- j++;
- if(Matrix[i][j] != "0" && Matrix[i][j] != undefined && Matrix[i][j].substr(0,4) != "lock")
- {
- slide1 = FindName(i,j);
- _root["m" + String(eval(slide))] = setInterval(MovingRight,Speed,eval(slide),eval(slide)._x,chk);
- _root["m" + String(eval(slide1))] = setInterval(MovingLeft,Speed,eval(slide1),eval(slide1)._x,chk);
- }
- else
- {
- notBlock = true;
- }
- }
- function Follow()
- {
- this._x = _root._xmouse - 20;
- this._y = _root._ymouse - 5;
- Mouse.hide();
- updateAfterEvent();
- }
- function onHammerClick()
- {
- if(!moveart && notBlock)
- {
- if(!hammeruse)
- {
- hammeruse = true;
- Hammer--;
- hammer._alpha = 50;
- notBlock = false;
- Mouse.hide();
- _root.attachMovie("hammer","ham",_root.getNextHighestDepth());
- ham._x = HamX;
- ham._y = HamY;
- ham.onMouseMove = Follow;
- }
- }
- else if(hammeruse)
- {
- hammer._alpha = 100;
- ham.removeMovieClip();
- Hammer++;
- hammeruse = false;
- Mouse.show();
- notBlock = true;
- }
- }
- function onDiggerClick()
- {
- if(notBlock && !moveart)
- {
- notBlock = false;
- if(SoundOn)
- {
- digger_s.start();
- }
- Digger--;
- TextShow(dign,"x" + Digger,"h",0,0,0);
- if(!Digger)
- {
- digger.removeMovieClip();
- dign.TEXT.removeMovieClip();
- }
- var i = 0;
- while(i < Matrix.length)
- {
- var j = 0;
- while(j < Matrix[i].length)
- {
- if(Matrix[i][j].substr(1,5) == "slice" && (Matrix[i + 1][j].substr(0,1) == "s" || Matrix[i + 1][j].substr(5,1) == "s"))
- {
- var Name = FindName(i + 1,j);
- _root.attachMovie("lopata","l" + Name,_root.getNextHighestDepth(),{_x:GlobalX + j * Size,_y:GlobalY + (i + 1) * Size});
- eval(Name).setMask("l" + Name);
- Matrix[i + 1][j] = "no";
- }
- j++;
- }
- i++;
- }
- }
- }
- function onWatchClick()
- {
- if(notBlock && !moveart)
- {
- if(SoundOn)
- {
- watch_s.start();
- }
- Watch--;
- TextShow(watn,"x" + Watch,"h",0,0,0);
- if(!Watch)
- {
- watch.removeMovieClip();
- watn.TEXT.removeMovieClip();
- }
- var eend = EndTime;
- AddingTime = 0;
- eend += totaltime / 5;
- if(eend > totaltime + getTimer())
- {
- eend = totaltime + getTimer();
- }
- clearInterval(AddT);
- AddT = setInterval(AddTime,50,(eend - EndTime) / 20);
- }
- }
- function AddTime(times)
- {
- AddingTime++;
- EndTime += times;
- Timing();
- if(AddingTime == 20)
- {
- clearInterval(AddT);
- }
- updateAfterEvent();
- }
- function onLampClick()
- {
- function ATTACH(i, j)
- {
- if(Matrix[i][j].substr(0,5) == "slide")
- {
- var temp1 = Math.round(Math.random() * (Nomer - 1)) + 1;
- var temp = "slide" + temp1;
- Matrix[i][j] = temp;
- var temp3 = FindName(i,j);
- eval(temp3).removeMovieClip();
- _root.attachMovie(temp,temp3,_root.getNextHighestDepth(),{_width:Size,_height:Size});
- var ttt = Math.round(Math.random() * 1000);
- _root.attachMovie("lampb","l" + ttt,_root.getNextHighestDepth(),{_width:Size,_height:Size});
- eval(temp3)._x = GlobalX + j * Size;
- eval(temp3)._y = GlobalY + i * Size;
- InitSlide(temp3);
- eval("l" + ttt)._x = GlobalX + j * Size - 2;
- eval("l" + ttt)._y = GlobalY + i * Size - 2;
- }
- }
- if(notBlock && !moveart)
- {
- if(SoundOn)
- {
- lamp_s.start();
- }
- notBlock = false;
- Lamp--;
- TextShow(lamn,"x" + Lamp,"h",0,0,0);
- if(!Lamp)
- {
- lamp.removeMovieClip();
- lamn.TEXT.removeMovieClip();
- }
- var i = 0;
- while(i < Matrix.length)
- {
- var j = 0;
- while(j < Matrix[i].length)
- {
- if(Matrix[i][j].substr(1,5) == "slice")
- {
- ATTACH(i - 1,j - 1);
- ATTACH(i - 1,j + 1);
- ATTACH(i + 1,j - 1);
- ATTACH(i + 1,j + 1);
- ATTACH(i - 1,j);
- ATTACH(i,j - 1);
- ATTACH(i + 1,j);
- ATTACH(i,j + 1);
- }
- j++;
- }
- i++;
- }
- }
- }
- function DragSlide(x, x1, y, y1, slide)
- {
- notBlock = false;
- var _loc1_ = String(slide);
- if(x > x1 + Step && Math.abs(x - x1) >= Math.abs(y - y1))
- {
- CheckSuccess(FindIndexX(_loc1_),FindIndexY(_loc1_),FindIndexX(_loc1_),FindIndexY(_loc1_) - 1);
- MoveLeft(slide);
- }
- else if(x + Step < x1 && Math.abs(x - x1) >= Math.abs(y - y1))
- {
- CheckSuccess(FindIndexX(_loc1_),FindIndexY(_loc1_),FindIndexX(_loc1_),Number(FindIndexY(_loc1_)) + 1);
- MoveRight(slide);
- }
- else if(y + Step < y1 && Math.abs(x - x1) < Math.abs(y - y1))
- {
- CheckSuccess(FindIndexX(_loc1_),FindIndexY(_loc1_),Number(FindIndexX(_loc1_)) + 1,FindIndexY(_loc1_));
- MoveDown(slide);
- }
- else if(y > y1 + Step && Math.abs(x - x1) < Math.abs(y - y1))
- {
- CheckSuccess(FindIndexX(_loc1_),FindIndexY(_loc1_),FindIndexX(_loc1_) - 1,FindIndexY(_loc1_));
- MoveUp(slide);
- }
- else
- {
- notBlock = true;
- }
- }
- function OverMove()
- {
- if(notBlock || hammeruse)
- {
- if(Blink != this)
- {
- eval(this + "fon").gotoAndStop(2);
- }
- }
- }
- function OutMove()
- {
- if(notBlock || hammeruse)
- {
- if(Blink != this)
- {
- eval(this + "fon").gotoAndStop(1);
- }
- }
- }
- function Press()
- {
- if(notBlock)
- {
- StartTimer();
- if(SoundOn)
- {
- click_s.start();
- }
- if(CheckClick(this))
- {
- eval(Blink + "fon").gotoAndStop(1);
- eval(this + "fon").gotoAndStop(3);
- Blink = this;
- }
- x = _root._xmouse;
- y = _root._ymouse;
- var temp = String(this);
- oMouse = {};
- oMouse.onMouseMove = function()
- {
- Dragging(temp);
- };
- Mouse.addListener(oMouse);
- value = this;
- }
- if(hammeruse)
- {
- var i = FindIndexX(String(this));
- var j = FindIndexY(String(this));
- if(Matrix[i][j].substr(0,5) == "slide" || Matrix[i][j].substr(5,5) == "slide")
- {
- if(SoundOn)
- {
- hammer_s.start();
- }
- Blow(i,j);
- ham.removeMovieClip();
- if(!Hammer)
- {
- hammer.removeMovieClip();
- hamn.TEXT.removeMovieClip();
- }
- else
- {
- hammer._alpha = 100;
- TextShow(hamn,"x" + Hammer,"h",0,0,0);
- }
- fall = setInterval(function()
- {
- hammeruse = false;
- Mouse.show();
- var i = 0;
- while(i < Matrix.length)
- {
- var j = 0;
- while(j < Matrix[0].length)
- {
- eval("s" + i + j + "fon").gotoAndStop(1);
- j++;
- }
- i++;
- }
- FallDown(Matrix);
- }
- ,500);
- }
- }
- }
- function Dragging(str)
- {
- var x1 = _root._xmouse;
- var y1 = _root._ymouse;
- if(Math.abs(x - x1) > 10 || Math.abs(y - y1) > 10)
- {
- Mouse.removeListener(oMouse);
- if(notBlock)
- {
- DragSlide(x,x1,y,y1,eval(str));
- }
- }
- }
- function Release()
- {
- Mouse.removeListener(oMouse);
- }
- function FromHint()
- {
- hints.removeMovieClip();
- HH.removeMovieClip();
- buttonhelp.removeMovieClip();
- hints.removeMovieClip();
- Mouse.removeListener(ooMouse);
- StartHint();
- StartTimer();
- }
- function GoHints(x, y)
- {
- _root.attachMovie("hints","hints",_root.getNextHighestDepth(),{_x:x,_y:y});
- }
- function Hints(hint)
- {
- function FindSlide(slide)
- {
- var _loc2_ = 0;
- while(_loc2_ < Matrix.length)
- {
- var _loc1_ = 0;
- while(_loc1_ < Matrix[_loc2_].length)
- {
- if(Matrix[_loc2_][_loc1_] == slide)
- {
- GoHints(GlobalX + _loc1_ * Size + 7,GlobalY + Size * (_loc2_ - 1));
- break;
- }
- _loc1_ = _loc1_ + 1;
- }
- _loc2_ = _loc2_ + 1;
- }
- }
- function ConvertText(hint)
- {
- var _loc4_ = "";
- var _loc2_ = 0;
- var _loc1_ = 0;
- while(_loc1_ < hint.length)
- {
- var _loc3_ = hint.substr(_loc1_,1);
- if(_loc3_ == "|")
- {
- if(_loc2_ > Letter)
- {
- Letter = _loc2_;
- }
- _loc2_ = 0;
- _loc4_ += "\n";
- Lines++;
- }
- else
- {
- _loc4_ += _loc3_;
- _loc2_ = _loc2_ + 1;
- }
- _loc1_ = _loc1_ + 1;
- }
- if(_loc2_ > Letter)
- {
- Letter = _loc2_;
- }
- return _loc4_;
- }
- if(notBlock && !moveart)
- {
- if(SoundOn)
- {
- hint_s.start();
- }
- FromHint();
- StopHint();
- ooMouse = {};
- ooMouse.onMouseDown = FromHint;
- Mouse.addListener(ooMouse);
- clearInterval(HHH);
- hints.removeMovieClip();
- HH.removeMovieClip();
- buttonhelp.removeMovieClip();
- bla.removeMovieClip();
- var X = 190;
- var Y = 280;
- var Lines = 1;
- var Letter = 1;
- delete hints;
- StopTimer();
- _root.attachMovie("help","hints",_root.getNextHighestDepth());
- _root.createEmptyMovieClip("HH",_root.getNextHighestDepth());
- HH.createTextField("hinttext",_root.getNextHighestDepth(),0,0,0,0);
- _root.attachMovie("buttonhelp","buttonhelp",_root.getNextHighestDepth());
- hints._width = 330;
- HH.hinttext.multiline = true;
- HH.hinttext.autoSize = "left";
- HH.hinttext.selectable = false;
- buttonhelp.onPress = FromHint;
- format = new TextFormat();
- format.font = "Arial";
- format.size = "12";
- format.bold = true;
- format.color = 12303155;
- format.align = "center";
- switch(hint)
- {
- case "begin":
- Y = FindStop(Matrix) * Size + GlobalY;
- X = 0;
- HH.hinttext.text = ConvertText(hint0);
- break;
- case "art":
- FindSlide("gslice1");
- HH.hinttext.text = ConvertText(hint1);
- break;
- case "swap":
- Y = FindStop(Matrix) * Size + GlobalY;
- X = 0;
- HH.hinttext.text = ConvertText(hint2);
- break;
- case "art2":
- FindSlide("gslice2");
- FindSlide("gslice3");
- HH.hinttext.text = ConvertText(hint3);
- break;
- case "time":
- GoHints(240,300);
- Y = 200;
- HH.hinttext.text = ConvertText(hint4);
- break;
- case "hammer":
- FindSlide("hammer");
- HH.hinttext.text = ConvertText(hint5);
- break;
- case "digger":
- FindSlide("digger");
- HH.hinttext.text = ConvertText(hint6);
- break;
- case "watch":
- FindSlide("watch");
- HH.hinttext.text = ConvertText(hint7);
- break;
- case "lamp":
- FindSlide("lamp");
- HH.hinttext.text = ConvertText(hint8);
- break;
- case "hammer2":
- Y = 200;
- GoHints(250,320);
- HH.hinttext.text = ConvertText(hint9);
- break;
- case "digger2":
- Y = 200;
- GoHints(320,320);
- HH.hinttext.text = ConvertText(hint10);
- break;
- case "watch2":
- Y = 200;
- GoHints(395,320);
- HH.hinttext.text = ConvertText(hint11);
- break;
- case "lamp2":
- Y = 200;
- GoHints(455,320);
- HH.hinttext.text = ConvertText(hint12);
- }
- HH.hinttext.setTextFormat(format);
- hints._height = 25 + (Lines + 1) * 15;
- hints._width = 20 + (Letter + 1) * 6;
- buttonhelp._y = Y + (Lines + 1) * 15 + 3;
- hints._x = X;
- hints._y = Y;
- HH._x = X + 15;
- HH._y = Y + 10;
- buttonhelp._x = X + hints._width / 2 - 10;
- }
- }
- function CheckSuccess(i1, j1, i2, j2)
- {
- if(Matrix[i1][j1] != undefined && Matrix[i1][j1] != "0" && Matrix[i2][j2] != "0" && Matrix[i2][j2] != undefined && Matrix[i2][j2].substr(0.1) != "l")
- {
- if(SoundOn)
- {
- var _loc1_ = false;
- _loc1_ = Finding(i1,j1,i2,j2);
- if(!_loc1_)
- {
- _loc1_ = Finding(i2,j2,i1,j1);
- }
- if(_loc1_)
- {
- yes_s.start();
- }
- else
- {
- no_s.start();
- }
- }
- }
- }
- stop();
- RedyToPlay = redytoend = false;
- fromhint = true;
- MaxC = countries.length - 1;
- N = 3;
- Life = 3;
- NextLife = 35000;
- NumTail = 20;
- TailPeriod = 100;
- RoundSity = 0;
- mmm = Add = RoundCountry = score = 0;
- Hammer = Lamp = Digger = Watch = 0;
- SoundOn = hbegin = hart = hart2 = htime = hswap = hhammer = hhammer2 = hwatch = hwatch2 = hlamp = hlamp2 = hdigger = hdigger2 = true;
- ArtX = 15;
- ArtY = 30;
- var Speed = 0;
- Step = 5;
- Size = 32;
- Size1 = 29;
- HamX = 249;
- HamY = 349;
- LamX = 448;
- LamY = 348;
- DigX = 320;
- DigY = 348;
- WatX = 390;
- WatY = 348;
- GameSpeed = 400;
- oKey = {};
- oKey.onKeyDown = function()
- {
- if(Key.getAscii() == String("c").charCodeAt())
- {
- delete ArtPos;
- ArtPos = new Array();
- if(Key.isDown(38))
- {
- RoundSity = 5;
- RoundCountry = 0;
- EndRound();
- }
- if(Key.isDown(40))
- {
- GameOver();
- }
- if(Key.isDown(37))
- {
- Life = 0;
- GameOver();
- }
- if(Key.isDown(39))
- {
- RoundSity = 8;
- RoundCountry = 2;
- EndRound();
- }
- InitArt(RoundCountry,RoundSity);
- }
- };
- Key.addListener(oKey);
- dig.useHandCursor = false;
- this.attachMovie("helppanel","help",this.getNextHighestDepth());
- delete ArtPos;
- ArtPos = new Array();
- InitArt(RoundCountry,RoundSity);
-